package cn.tedu.controller;

import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController//这个类是controller层的代码+可以接受浏览器发来的请求
@RequestMapping("/car4")//和地址栏里的url匹配
public class Car4Controller {
    //地址栏:http://localhost:8080/car4/get3/1/10
    //{id}是restful的特殊语法: 从地址栏里获取参数的值
    @RequestMapping("/get3/{age}/{name}")

    public String get3(
            //获取{id}里id的值
            @PathVariable int age,
            @PathVariable String name){
        //给浏览器做出响应,结果展示在页面上
        return age+"~~"+name ;
    }
    @RequestMapping("/get2")//和地址栏里的url匹配
    public String get2(int age,String name){
        //给浏览器做出响应,结果展示在页面上
        return age+"~~"+name;
    }
    @RequestMapping("/get")
    public String get(){
        return "你好啊！";
    }
}
